//
//  UIButton+Custom.m
//
//  Created by wd on 15/6/9.
//  Copyright (c) 2015年 wd. All rights reserved.
//

#import "UIButton+Custom.h"

@implementation UIButton (Custom)

+ (instancetype)buttonWithTitle:(NSString *)title addTarget:(id)target action:(SEL)action;
{
    UIButton *rightBackgroundView = [UIButton buttonWithType:UIButtonTypeCustom];
    rightBackgroundView.frame = CGRectMake(0, 0, 64, 24);
    rightBackgroundView.layer.cornerRadius = 3.0;
    rightBackgroundView.clipsToBounds = YES;
    rightBackgroundView.backgroundColor = [UIColor clearColor];
    [rightBackgroundView setTitle:title forState:UIControlStateNormal];
    [rightBackgroundView setTitleColor:HexRGBA(0xffffff, 0.7) forState:UIControlStateHighlighted];
    [rightBackgroundView setBackgroundImage:[UIImage imageWithColor:HexRGBA(0xf89112, 0.6) andSize:rightBackgroundView.bounds.size] forState:UIControlStateHighlighted];
    rightBackgroundView.titleLabel.font = [UIFont systemFontOfSize:16.0];
    [rightBackgroundView addTarget:target action:action  forControlEvents:UIControlEventTouchUpInside];
    return rightBackgroundView;
}

@end
